package com.lysj.bhp.manager.repository;

import com.lysj.bhp.manager.domain.Staff;
import com.lysj.bhp.util.web.SelectItem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface StaffRepository extends JpaRepository<Staff, Long>, JpaSpecificationExecutor {

    Staff findByUsername(String username);

    Staff findByToken(String token);

    @Query("select new com.lysj.bhp.util.web.SelectItem(t.staffId AS value,t.realname AS name) from Staff t")
    List<SelectItem> selectItems();

    List<Staff> findByRoleId(Long roleId);


}
